public class TcpThread {

    public static volatile   boolean  isRunning = true;

    public static  int a = 10;

    public static volatile int count =0;

    public static void main(String[] args) {

        new Thread(new Runnable() {
            @Override
            public void run() {
                while (isRunning){
                    try {
                        Thread.sleep(500);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    System.out.println("a=="+a);
                }
                System.out.println("已经停止！！");
            }
        }).start();
     new Thread(new Runnable() {
          @Override
          public void run() {
              try {
                  Thread.sleep(2000);
              } catch (InterruptedException e) {
                  e.printStackTrace();
              }
              a= 500;
          }
      }).start();
        }
}
